<?php
$username = trim($_POST['username']); //使用POST全局数组获取前端表单提交的数据
$pw = trim($_POST['pw']);
$email = trim($_POST['email']);
$pic = $_POST['pic'];
$nickname = $_POST['nickname'];
$birthday = $_POST['birthday'];
//进行后端数据验证
$a = array();
if(!strlen($username) || !strlen($pw)){
    $a['cdoe'] = -1;
    $a['msg']='用户名和密码都必须要填写';
    echo json_encode($a);
    exit;
}
include_once 'conn.php';
$dataBase = new Bbs();
$result = $dataBase -> checkUserName($username);
if($result['code'] == -1){
    echo json_encode($result);
    exit;
}
$result = $dataBase -> singup($_POST);
echo json_encode($result);
?>